/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.hnilica.cisteniulic.dto;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 * Instance slouzi k prenaseni atributu osob, ktere se registruji nebo chteji 
 * byt registrovany.
 *
 * @author swosh
 */
@Entity
@Table(name = "osoba")
public class Osoba implements Serializable {
    static final long serialVersionUID = 1L;


    private int id;
    private String email;
    private String heslo;
    private Date napPos;
    private String aktHash;

    public Osoba(String email, String heslo) {
        this.email = email;
        this.heslo = heslo;
    }

    public Osoba(String email) {
        this(email, null);
    }

    public Osoba() {
    }

    @Column(unique = true)
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Column(nullable = false)
    public String getHeslo() {
        return heslo;
    }

    public void setHeslo(String heslo) {
        this.heslo = heslo;
    }

    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    @Column(name = "naposledy_poslano")
    public Date getNapPos() {
        return napPos;
    }

    public void setNapPos(Date napPos) {
        this.napPos = napPos;
    }

    /**
     *
     * @return
     *
     */
    @Id
    @SequenceGenerator(name = "osoba_seq", sequenceName="osoba_seq", allocationSize=1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "osoba_seq")
    public int getId() {
        return id;
    }

    /**
     *
     * @param id
     */
    public void setId(int id) {
        this.id = id;
    }

    @Column(name="akt_hash",nullable = false)
    public String getAktHash() {
        return aktHash;
    }

    public void setAktHash(String aktHash) {
        this.aktHash = aktHash;
    }

}
